﻿#include "ConcreteCompany.h"
#include <QDebug>

ConcreteCompany::ConcreteCompany(QString name) : Company(name)
{

}

void ConcreteCompany::Add(const shared_ptr<Company> &c)
{
    m_children.append(c);
}

void ConcreteCompany::Remove(const shared_ptr<Company> &c)
{
    m_children.removeOne(c);
}

void ConcreteCompany::Display(int depth)
{
    qDebug() << QString(depth, '-') << QString(" %1").arg(m_name);

    for (int i = 0; i < m_children.size(); i++) {
        m_children[i]->Display(depth + 2);
    }
}

void ConcreteCompany::LineOfDuty()
{
    for (int i = 0; i < m_children.size(); i++) {
        m_children[i]->LineOfDuty();
    }
}
